package com.cloudsigns.factorymanager2.project.utils;

import android.text.TextUtils;

/**
 * Created by tony on 2017/12/9.
 */

public class ConstantUtil {
    /*规格尺寸 类型*/
    /*添加产品信息*/
    public static final int ADD_PRODUCT_INFOMATION = 0x0004;
    /*添加产品清单*/
    public static final int ADD_PRODUCT_LIST = 0x0005;
    /*修改产品信息*/
    public static final int EDIT_PRODUCT_INFOMATION = 0x0006;
    /*删除产品信息*/
    public static final int DELETE_PRODUCT_INFOMATION = 0x0007;
    /*删除产品信息*/
    public static final int CREATED_ORDER = 0x0008;

    /*第一个fragment*/
    public static final int TAB_FRAGMENT_FIRST = 0x009;
    /*第二个fragment*/
    public static final int TAB_FRAGMENT_SECOND = 0x0010;
    /*返工*/
    public static final int TYPE_REWORK = 0x0011;

    /*产品质检退回处理*/
    public static final int PRODUCT_QUALITY_CHECKBACK_PROCESSING = 0x0012;
    /*添加竣工评价*/
    public static final int ADD_COMPLETION_OF_EVALUATION = 0x0013;
    /*人员设置*/
    public static final int ADD_PERSONNEL_SETTING = 0x0014;
    /*登陆成功*/
    public static final int LOGIN_SUCCESS = 0x0015;
    /*登录失败*/
    public static final int LOGIN_FAILED = 0x0016;

    public static final int START_ACTIVITY_KEY_1 = 0x0017;
    /*跳转Activity key*/
    public static final int START_ACTIVITY_KEY_2 = 0x0018;

    public static final int START_ACTIVITY_KEY_3 = 0x0019;
    /*添加产品信息*/
    public static final int ADD_WORKPART_INFOMATION = 0x0020;
    /*删除工序加工信息*/
    public static final int DELETE_WORKPART_INFOMATION = 0x0021;

    /*产品品信息key*/
    public static final String PRODUCTBEAN = "ProductBean";
    /*人员设置key*/
    public static final String PERSONNELSETTINGBEAN = "PersonnelSettingBean";
    /*产品清单*/
    public static final String PRODUCTLIST = "ProductList";

    /*产品清单*/
    public static final String ENGINEERING_INFO = "engineering_info";
    /*产品退回*/
    public static final String PRODUCTREWORKBEAN = "ProductReworkBean";
    /*项目名*/
    public static final String PROJECT_NAME = "project_name";
    /*工程名称*/
    public static final String ENGINEERING_NAME = "engineering_name";
    /*key1*/
    public static final String KEY_1 = "key_1";
    /*key2*/
    public static final String KEY_2 = "key_2";
    /*key3*/
    public static final String KEY_3 = "key_3";
    /*key4*/
    public static final String KEY_4 = "key_4";
    /*竣工评价*/
    public static final String COMPLETION_OF_EVALUATION_BEAN = "completion_of_evaluation_bean";
    /*工序信息key*/
    public static final String WORKPARTBEAN = "WorkPartBean";

    public static final String CONTENT_TYPE = "application/json";
    public static final String CONTENT_TYPE_TEXT_JSON = "text/json";

    public static String getErrorCode(String code) {
        String errorStr = "";
        if (!TextUtils.isEmpty(code)) {
            int error_code = Integer.parseInt(code);
            switch (error_code) {
                case -3:
                    errorStr = "参数错误";
                    break;
                case -4:
                    errorStr = "用户名或密码错";
                    break;
                case -5:
                    errorStr = "数据重复";
                    break;
                case -6:
                    errorStr = "token验证失败";
                    break;
                case -7:
                    errorStr = "没有访问权限";
                    break;
                case -8:
                    errorStr = "你不是这个订单的接收人";
                    break;
                case -9:
                    errorStr = "这个订单已经被接收或退回了";
                    break;
                case -10:
                    errorStr = "这个订单已经被接收或退回了";
                    break;
                case -11:
                    errorStr = "你不是这个订单的拥有者";
                    break;
                case -12:
                    errorStr = "没找到指定账号";
                    break;
                case -13:
                    errorStr = "根据id找不到对象";
                    break;

            }
        }
        return errorStr;
    }

}
